import { filterNullFields } from '@/utils/fomatter';
import httpService from '../httpService';

 /**
 * 查询基金从业考试配置
 * @returns 
 */
 function queryExaminationConfig() {
    return httpService.get(`/question/query/examination_config`)
}

/**
 * 获取错题 基金从业考试答卷内容列表
 * @returns 
 */
function queryWrongTypeList() {
    var params = {
        'true_or_fail': 2, 
    }
    return httpService.get(`/question/fund_examination/answer_list_v2`,params)
}

 /**
 * 获取基金从业考试随机问卷
 * @param type 
 * @param limit 
 * @returns 
 */
function getFundExamination(type,limit) {
    var params = {
        'type': type, 
        'limit':limit
    }
    return httpService.get(`/question/get/fund_examination`, params)
}


/**
 * 提交基金从业考试随机问卷
 * @param questionnaire_id 
 * @param answer_value_str 
 * @param questionnaire_type 
 * @returns 
 */
function submitFundExamination(questionnaire_id,answer_value_str,questionnaire_type) {
    var params = {
        'questionnaire_id': questionnaire_id, 
        'answer_value_str':answer_value_str,
        'questionnaire_type':questionnaire_type
    }
    return httpService.post(`/question/submit/general_paper`, params)
}


/**
 * 获取错题本的列表
 * @returns 
 */
function getWrongList() {
    var params = {
        'true_or_fail': 2, 
        'questionnaire_type':7,
    }
    return httpService.get(`/question/fund_examination/answer_list`, params)
}


/**
 * 根据提交答案的ID查询详情
 * @param detail_ids 
 * @returns 
 */
function getFundExaminationAnswerDetail(detail_ids) {
    var params = {
        'detail_ids': detail_ids, 
    }
    return httpService.get(`/question/get/answer_detail`, params)
}


export {
    queryExaminationConfig,
    queryWrongTypeList,
    getFundExamination,
    submitFundExamination,
    getWrongList,
    getFundExaminationAnswerDetail,
}

